# $Id$
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Roman Kyrylych <roman@archlinux.org>

pkgname=gnome-bluetooth
pkgver=3.20.1+1+ge902d1a
pkgrel=1
pkgdesc="The GNOME Bluetooth Subsystem"
url="https://wiki.gnome.org/Projects/GnomeBluetooth"
arch=(i686 x86_64)
license=(GPL LGPL)
depends=(gtk3 libnotify bluez libcanberra libsystemd pulseaudio-bluetooth)
makedepends=(intltool gobject-introspection itstool docbook-xsl gnome-common git systemd)
_commit=e902d1aca835bfc823e5e4cf2b37f5444d606042  # master
source=("git+https://git.gnome.org/browse/gnome-bluetooth#commit=$_commit"
        61-gnome-bluetooth-rfkill.rules)
sha256sums=('SKIP'
            '8dd2d3637f380a89e72f65e6c8021e994ccbdc645f1a1b1dbffe74ac9f061f53')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^GNOMEBT_V_//;s/_/./g;s/-/+/g'
}

prepare() {
  cd $pkgname
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --enable-gtk-doc \
    --disable-desktop-update \
    --disable-icon-update \
    --disable-schemas-compile

  # https://bugzilla.gnome.org/show_bug.cgi?id=655517
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install

  install -m644 -D ../61-gnome-bluetooth-rfkill.rules \
      "$pkgdir/usr/lib/udev/rules.d//61-gnome-bluetooth-rfkill.rules"
}
